// UsesStatTable.h : stores the variables used in each statement.
// Author: Achyut P Balaji
//

#ifndef USES_STAT_TABLE_H
#define USES_STAT_TABLE_H
#include"../../SPA_Data_Types.h"
#include <iostream>

using namespace std;

typedef vector<VAR_INDEX> VAR_LIST;

class UsesStatTable {
private:

	INTEGER **usesTable;

	INTEGER noofstmts;
	INTEGER noofvars;

	static UsesStatTable *obj;
	UsesStatTable(int noOfStmts, int noOfVars);
	~UsesStatTable();

	vector<VAR_INDEX> tempVector;

	bool initialised;

public:

	static UsesStatTable* getInstance();
	static UsesStatTable* getFirstInstance(int noOfStmts, int noOfVars);

	BOOLEAN addEntry(STATEMENT_INDEX n, VAR_LIST varUsed);

	BOOLEAN isUsed(STATEMENT_INDEX n, VAR_INDEX ind);
	VAR_LIST* getVarUsed(STATEMENT_INDEX n);
	STMT_LIST* getStmtUsedIn(VAR_INDEX v);

	void initialise();
	void emptyTempVector();

};


#endif